home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Freeware / First Page 2006 3.00 / fp2006-final-3.00-setup.exe / {app} / Iscripts / Forms Misc / check-by-group.izs < prev    next >
Text File  |  2005-09-28  |  5KB  |  187 lines

  1. <!NOWIZARD>
  2.  
  3. <!TITLE>Check By Group
  4. <!/TITLE>
  5.  
  6. <!DESCRIPTION>This script checks all the checkboxes in a certain group, you just simply select the group from the drop down list!<!/DESCRIPTION> 
  7.  
  8. <!CATEGORY>Forms<!/CATEGORY>
  9.  
  10. <!SCRIPT>
  11. <!-- START OF SCRIPT -->
  12.  
  13. <!-- HOW TO INSTALL CHECK BY GROUP:
  14.  
  15.   1.  Copy code into the HEAD section of document
  16.   2.  Put last coding into the BODY section of document  -->
  17.  
  18. <!-- STEP ONE: Add code into HEAD section of document  -->
  19.  
  20. <HEAD>
  21.  
  22. <SCRIPT LANGUAGE="JavaScript">
  23.  
  24.  
  25. <!-- Original:  Mike Elkins (m_c_elkins@hotmail.com) -->
  26.  
  27. <!-- Begin
  28.   function selectivecheck(field, myselection)
  29.     {
  30.       var fieldid;
  31.       var pos;
  32.       var criteria;
  33.       var strng;
  34.       strng = myselection.value;
  35.       for (i=0; i<field.length; i++)
  36.         {
  37.           if (strng=="all")
  38.             {
  39.             field[i].checked = true;
  40.             }
  41.           else
  42.             {
  43.               fieldid = field[i].id;
  44.               pos = strng.substring(0,1);
  45.               criteria = strng.substring(1,2);  //this gets the information we want to evaluate
  46.               if (fieldid.substring(pos,pos+1)==criteria)
  47.                 {
  48.                   field[i].checked = true;
  49.                 }
  50.               else
  51.                 {
  52.                   field[i].checked = false; //you could leave this out if you don't want to clear the check boxes
  53.                 }
  54.             }
  55.         }
  56.     }
  57. //  End -->
  58. </script>
  59.  
  60. </HEAD>
  61.  
  62. <!-- STEP TWO: Add code into BODY section of document  -->
  63.  
  64. <BODY>
  65.  
  66. <form>
  67. <table align="center">
  68. <tr><td>
  69. <!--Load each ID with a string that will be parsed later -->
  70.   <input id=a1 type=checkbox name=list value="1">Group A SubGroup 1<br>
  71.   <input id=a2 type=checkbox name=list value="2">Group A SubGroup 2<br>
  72.   <input id=b1 type=checkbox name=list value="3">Group B SubGroup 1<br>
  73.   <input id=b2 type=checkbox name=list value="4">Group B SubGroup 2<br>
  74.   <input id=c1 type=checkbox name=list value="5">Group C SubGroup 1<br>
  75.   <input id=c2 type=checkbox name=list value="6">Group C SubGroup 2<br>
  76. <!--Set your option values that contain a position and then the criteria-->
  77. <p>
  78. Group Selection: <select size="1" name="mycombobox">
  79.   <option value="all">All Groups</option>
  80.   <option value="0a ">Group A</option>
  81.   <option value="0b ">Group B</option>
  82.   <option value="0c ">Group C</option>
  83.   <option value="11 ">SubGroup 1</option>
  84.   <option value="12 ">SubGroup 2</option>
  85. </select>
  86. <br>
  87. <div align="center">
  88. <input type="button" value="Select Group" onclick=" selectivecheck(this.form.list, this.form.mycombobox)">
  89. </div>
  90. </td></tr>
  91. </table>
  92. </form>
  93.  
  94.  
  95. <!-- END OF SCRIPT -->
  96. <!/SCRIPT>
  97.  
  98. <!PREVIEW>
  99. <!-- START OF SCRIPT -->
  100.  
  101. <!-- HOW TO INSTALL CHECK BY GROUP:
  102.  
  103.   1.  Copy code into the HEAD section of document
  104.   2.  Put last coding into the BODY section of document  -->
  105.  
  106. <!-- STEP ONE: Add code into HEAD section of document  -->
  107.  
  108. <HEAD>
  109.  
  110. <SCRIPT LANGUAGE="JavaScript">
  111.  
  112.  
  113. <!-- Original:  Mike Elkins (m_c_elkins@hotmail.com) -->
  114.  
  115. <!-- Begin
  116.   function selectivecheck(field, myselection)
  117.     {
  118.       var fieldid;
  119.       var pos;
  120.       var criteria;
  121.       var strng;
  122.       strng = myselection.value;
  123.       for (i=0; i<field.length; i++)
  124.         {
  125.           if (strng=="all")
  126.             {
  127.             field[i].checked = true;
  128.             }
  129.           else
  130.             {
  131.               fieldid = field[i].id;
  132.               pos = strng.substring(0,1);
  133.               criteria = strng.substring(1,2);  //this gets the information we want to evaluate
  134.               if (fieldid.substring(pos,pos+1)==criteria)
  135.                 {
  136.                   field[i].checked = true;
  137.                 }
  138.               else
  139.                 {
  140.                   field[i].checked = false; //you could leave this out if you don't want to clear the check boxes
  141.                 }
  142.             }
  143.         }
  144.     }
  145. //  End -->
  146. </script>
  147.  
  148. </HEAD>
  149.  
  150. <!-- STEP TWO: Add code into BODY section of document  -->
  151.  
  152. <BODY>
  153.  
  154. <form>
  155. <table align="center">
  156. <tr><td>
  157. <!--Load each ID with a string that will be parsed later -->
  158.   <input id=a1 type=checkbox name=list value="1">Group A SubGroup 1<br>
  159.   <input id=a2 type=checkbox name=list value="2">Group A SubGroup 2<br>
  160.   <input id=b1 type=checkbox name=list value="3">Group B SubGroup 1<br>
  161.   <input id=b2 type=checkbox name=list value="4">Group B SubGroup 2<br>
  162.   <input id=c1 type=checkbox name=list value="5">Group C SubGroup 1<br>
  163.   <input id=c2 type=checkbox name=list value="6">Group C SubGroup 2<br>
  164. <!--Set your option values that contain a position and then the criteria-->
  165. <p>
  166. Group Selection: <select size="1" name="mycombobox">
  167.   <option value="all">All Groups</option>
  168.   <option value="0a ">Group A</option>
  169.   <option value="0b ">Group B</option>
  170.   <option value="0c ">Group C</option>
  171.   <option value="11 ">SubGroup 1</option>
  172.   <option value="12 ">SubGroup 2</option>
  173. </select>
  174. <br>
  175. <div align="center">
  176. <input type="button" value="Select Group" onclick=" selectivecheck(this.form.list, this.form.mycombobox)">
  177. </div>
  178. </td></tr>
  179. </table>
  180. </form>
  181.  
  182.  
  183. <!-- END OF SCRIPT -->
  184. <!/PREVIEW>
  185.  
  186. <!RELATED>NONE<!/RELATED>
  187.